package cn.myblog.ainblog.conroller;

import cn.myblog.ainblog.service.ArticleService;
import cn.myblog.ainblog.service.CategoryService;
import cn.myblog.ainblog.vo.ArticleCategoryVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;

import java.util.List;

/**
 * @author Dovaior
 * @Description photo_page的控制器
 * @create 2021-05-05 17:01
 **/
@Controller
public class PhotoPageController {
    @Autowired
    private CategoryService categoryService;
    @Autowired
    private ArticleService articleService;

    @GetMapping("/page_photo")
    public String pagePhoto(Model model){
        //封装全部分类信息
        model.addAttribute("categoryLists",categoryService.selectAll());
        //封装所有博文的id、图片以及分类名
        model.addAttribute("photoAndCateName",articleService.queryCoverAndCategoryToPhotoPage());
        return "page-photo";
    }
}
